function foo (): never {
//  死循环
  while(true) {}
}

function bar (): never {
  throw new Error()
}

function Handlemessage (message: string | number | boolean) {
  switch (typeof message) {
    case 'string':
      console.log('string')
      break
    case 'number':
      console.log('number')
      break
    case 'boolean':
      console.log('boolean')
      break
  }
}
Handlemessage ('abcd')
Handlemessage(1323)
Handlemessage(false)